<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Traning;
use App\Services\TraningService;
use Illuminate\Http\Request;

class TraningController extends Controller
{
    public function dashboard( TraningService $service)
    {
        return $this->success($service->dashboard());
    }
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index( Request $request, TraningService $service)
    {
        //
        $res = $service->getList($request->all());
        return $this->success($res);
    }
    public function join(Request $request, TraningService $service)
    {
        $service->join($request->input('id'));
        return $this->success([]);
    }
    
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Traning  $traning
     * @return \Illuminate\Http\Response
     */
    public function show($id, TraningService $service)
    {
        //
        return $this->success($service->getDetail($id));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Traning  $traning
     * @return \Illuminate\Http\Response
     */
    public function edit(Traning $traning)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Traning  $traning
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Traning $traning)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\Traning  $traning
     * @return \Illuminate\Http\Response
     */
    public function destroy(Traning $traning)
    {
        //
    }
}
